package com.shike.core.storage;

import com.shike.core.utils.Md5Util;
import lombok.Data;
import java.io.InputStream;
@Data
public class StorageService {
    private AbstractStorage storage;

    /**
     * 调用对象存储
     * @param inputStream
     * @param mimeType
     * @param keyName
     * @return
     */
    public String storage(InputStream inputStream, String mimeType, String keyName){
        String md5Code = Md5Util.getMD5Code(String.format("%s%s%s", keyName, System.currentTimeMillis(), Math.random()));
        String url = storage.upload(inputStream, mimeType, md5Code);
        return url;
    }
}
